package test;

import org.junit.Test;

/**
 * @author Liu Huan
 */

public class bitMove {
    @Test
    public void testBit(){
        System.out.println("Integer.toBinaryString(1) = " + Integer.toBinaryString(1));
        System.out.println("Integer.toBinaryString(-1) = " + Integer.toBinaryString(-1));
        System.out.println("Integer.toBinaryString(8) = " + Integer.toBinaryString(8));
        System.out.println("Integer.toBinaryString(9) = " + Integer.toBinaryString(9));
        System.out.println("Integer.toBinaryString(-8) = " + Integer.toBinaryString(-8));
        System.out.println("Integer.toBinaryString(-9) = " + Integer.toBinaryString(-9));
    
        System.out.println(Integer.parseInt("0"));
        System.out.println(Integer.parseInt("-0"));
        System.out.println(Integer.parseInt("+0"));
        System.out.println("Integer.toBinaryString(-1 >>> 31) = " + Integer.toBinaryString(-1 >>> 31));
        System.out.println("Integer.toBinaryString(-1 >> 31) = " + Integer.toBinaryString(-1 >> 31));
        System.out.println("Integer.toBinaryString(-1 << 31) = " + Integer.toBinaryString(-1 << 31));
    }
    
    @Test
    public void testOne(){
        boolean aa = true;
        boolean bb = true;
        System.out.println(aa |= bb);
    }
    
    // & | ~ ^ >> << >>>
    @Test
    public void testBitSym() {
        int a = 4;
        int b = 2;
        System.out.println(a | b);
        int c = 6;
        System.out.println(a & c);
        System.out.println(a ^ b);
        System.out.println(~a);
    }
    
}
